<%@ page import="com.scau.ums.model.User" %>
<%@ page import="com.scau.ums.util.tools.UserInfoTool" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.scau.ums.model.Repairreport" %>
<%@ page import="java.util.List" %>
<%@ page import="com.scau.ums.util.tools.RepairReportTool" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.scau.ums.model.Info" %>
<%@ page import="com.scau.ums.model.Suggestion" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: Superior
  Date: 2019/7/29
  Time: 22:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html class="no-js" lang="en">
<script src="js/jquery-3.3.1min.js"></script>
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>维修工功能界面</title>
    <meta name="robots" content="noindex, follow" />
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">

    <!-- CSS
	============================================ -->
    <!-- google fonts -->
    <link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,300i,400,400i,600,700,800,900%7CPoppins:300,400,500,600,700,800,900" rel="stylesheet">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrapmin.css">
    <!-- Font-awesome CSS -->
    <link rel="stylesheet" href="css/font-awesomemin.css">
    <!-- Slick slider css -->
    <link rel="stylesheet" href="css/slickmin.css">
    <!-- animate css -->
    <link rel="stylesheet" href="css/animate.css">
    <!-- Nice Select css -->
    <link rel="stylesheet" href="css/nice-select.css">
    <!-- jquery UI css -->
    <link rel="stylesheet" href="css/jqueryuimin.css">
    <!-- main style css -->
    <link rel="stylesheet" href="css/style.css">

    <style type="text/css">
    </style>

    <%--"我的"按钮判断跳转--%>
    <script>
        function wodeRedirect() {
            var jsUserType = '<%=request.getSession().getAttribute("USER_TYPE")%>';
            if(jsUserType=='<%=User.ADMIN%>')
            {
                window.location.href="/adminEntrance";
            }
            if(jsUserType=='<%=User.MAINTAINER%>')
            {
                window.location.href="/maintainerEntrance";
            }
            if(jsUserType=='<%=User.STUDENT%>'||jsUserType=='<%=User.TEACHER%>')
            {
                window.location.href="/userEntrance";
            }
        }
        function redirect(target) {
            var role = "<%=request.getSession().getAttribute("MAINTAINER_ROLE")%>";
            window.open(target,"_blank");
        }
    </script>
</head>

<body>




<header class="header-area">
    <div class="main-header d-none d-lg-block">
        <!--顶部left开始-->
        <div class="header-top black-bg">
            <div class="container">
                <!--顶部选择-->
                <div class="row align-items-center">
                    <div class="col-lg-6">
                        <div class="top-left-navigation">
                            <ul class="nav align-items-center">
                            </ul>
                        </div>
                    </div>
                    <div class="col-lg-6 d-flex justify-content-end">
                        <div class="header-social-link">
                        </div>
                        <ul class="user-info-block">
                            <!--登录开始-->
                            <%if (request.getSession().getAttribute("USER_NAME")==null){%>
                            <li><a href="/login"><i class="fa fa-sign-in"></i> 登录</a></li>
                            <%}else{%>
                            <ul class="nav">
                                <!--登录开始-->
                                <li class="mini-cart-wrap">
                                    <a href="/maintainerEntrance" class="minicart-btn">
                                        <span class="fa fa-user-circle-o"></span>
                                        <% String username=(String)request.getSession().getAttribute("USER_NAME");out.print(username);%>
                                    </a>

                                    <!--两个按钮开始-->
                                    <div class="cart-list-wrapper">
                                        <div class="minicart-button">
                                            <a onclick="wodeRedirect()"><i class="fa fa-user-plus"></i> 我的</a>
                                            <a href="/logout"><i class="fa fa-user-times"></i> 注销</a>
                                        </div>
                                    </div>
                                    <!--两个按钮结束-->
                                </li>
                                <!--登录结束-->
                            </ul>
                            <%}%>
                            <!--登录结束-->
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <!--顶部left结束-->

        <div class="header-main-area black-soft sticky">
            <div class="container">
                <div class="row align-items-center position-relative">
                    <!-- logo展示开始 -->
                    <div class="col-auto">
                        <div class="logo">
                            <a href="/">
                                <img src="/img/2.jpg" alt="Brand Logo">
                            </a>
                        </div>
                    </div>
                    <!-- logo展示结束 -->
                    <div class="col-auto position-static">
                        <div class="main-menu-area">
                            <div class="main-menu">
                                <!-- 标签栏开始 -->
                                <nav class="desktop-menu">
                                    <ul>
                                        <li class="active"><a href="/">主页 <i class="fa fa-angle-left"></i></a>
                                        </li>
                                    </ul>
                                </nav>
                                <!-- 标签栏结束 -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>

<main>
    <%--<img src="img/6.jpg">--%>
    <!-- 导航图片开始 -->
    <div class="breadcrumb-area breadcrumb-img bg-img" data-bg="img/6.jpg">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="breadcrumb-wrap">
                        <nav aria-label="breadcrumb">
                            <h3 class="breadcrumb-title">高校后勤综合信息管理平台</h3>
                            <ul class="breadcrumb justify-content-center">
                                <li class="breadcrumb-item"><a href="/"><i class="fa fa-home"></i></a></li>
                                <li class="breadcrumb-item"><a href="/maintainEntrance">维修工功能界面</a></li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 导航图片结束 -->


    <!-- 用户信息以及功能展示开始 -->
    <div class="my-account-wrapper section-padding">
        <div class="container">
            <div class="section-bg-color">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="myaccount-page-wrapper">
                            <div class="row">
                                <!--五个侧栏标签页开始-->
                                <div class="col-lg-3 col-md-4">
                                    <div class="myaccount-tab-menu nav" role="tablist">
                                        <a id="btn3" href="#userInfo"  data-toggle="tab"><i class="fa fa-address-book-o "></i>
                                            个人信息</a>
                                        <a id="btn4" href="#taskInfo" data-toggle="tab"><i class="fa fa-address-book-o "></i>
                                            待完成任务</a>
                                        <a id="btn8" href="/VerifyRepairReport" ><i class="fa fa-address-book-o "></i>
                                            审核报修单</a>
                                        <a id="btn6" href="#adminAction" data-toggle="tab"><i class="fa fa-address-book-o "></i>
                                            维修管理功能</a>
                                        <a id="btn7" href="/AnalyzeFinishedReports" ><i class="fa fa-address-book-o "></i>
                                            报修单分析</a>
                                        <a id="btn10" href="#history" data-toggle="tab"><i class="fa fa-address-book-o "></i>
                                            维修历史</a>
                                        <a id="btn5" href="#logout" data-toggle="tab"><i class="fa fa-address-book-o "></i>
                                            注销登录</a>
                                    </div>
                                </div>
                                <!--五个侧栏标签页结束-->

                                <!--功能选择面板开始-->
                                <div class="col-lg-9 col-md-8">
                                    <div class="tab-content" id="myaccountContent">
                                        <!-- 个人信息开始 -->
                                        <div class="tab-pane fade" id="userInfo" role="tabpanel">
                                            <div class="myaccount-content">
                                                <h5>用户信息</h5>

                                                <%
                                                    User maintainer=(User)request.getAttribute("maintainer");
                                                    int type=(Integer)session.getAttribute("USER_TYPE");

                                                    Map<String,String> map= UserInfoTool.getUserInfo(maintainer,type);

                                                %>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <table class="table table-bordered">
                                                        <%
                                                            for(Map.Entry<String,String> entry:map.entrySet()){
                                                        %>
                                                        <thead class="thead-light">
                                                        <tr>
                                                            <th><%=entry.getKey()%></th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                        <tr>
                                                            <td><%=entry.getValue()%></td>
                                                        </tr>
                                                        </tbody>
                                                        <%
                                                            }
                                                        %>
                                                    </table>
                                                </div>

                                            </div>
                                        </div>
                                        <!-- 个人信息结束 -->

                                        <!--待完成任务开始-->
                                        <div class="tab-pane fade" id="taskInfo" role="tabpanel">
                                            <div class="myaccount-content">
                                                <h5>我的任务</h5>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <div class="myaccount-tab-menu nav" role="tablist" style="-webkit-flex-direction:row">
                                                        <a id="btn1" href="#repairing" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-comments-o"></i>
                                                            正在进行的任务</a>
                                                        <a id="btn2" href="#repairover" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-file-audio-o "></i>
                                                            已完成的任务</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--待完成任务结束-->

                                        <!--维修管理功能-->
                                        <div class="tab-pane fade" id="adminAction" role="tabpanel">
                                            <div class="myaccount-content">
                                                <h5>维修管理功能</h5>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <div class="myaccount-tab-menu nav" role="tablist" style="-webkit-flex-direction:row">
                                                        <a id="orderTask" onclick="redirect('/OrderRepairTask')" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-comments-o"></i>
                                                            分配任务</a>
                                                        <a id="cancelTask" onclick="redirect('/cancelTask')" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-file-audio-o "></i>
                                                            取消任务</a>
                                                        <a id="result" onclick="redirect('/RepairResult')" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-comments-o"></i>
                                                            填写维修结果</a>
                                                        <a id="material" onclick="redirect('/RepairMaterial')" data-toggle="tab" style="width:180px;text-align:left;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(229, 229, 229)"><i class="fa fa-comments-o"></i>
                                                            填写维修材料</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--维修管理功能-->

                                        <!-- 维修历史开始 -->
                                        <div class="tab-pane fade" id="history" role="tabpanel">

                                            <div class="myaccount-content">
                                                <h5>维修历史</h5>

                                                    <%
                                                        List<Map<String, Object>> repairhistory=(List<Map<String, Object>>)request.getAttribute("repairhistory");
                                                        if(repairhistory.size()==0){
                                                    %>
                                                    <h5>目前还没有数据哟~</h5>
                                                    <%
                                                    }else{
                                                    %>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <table class="table table-bordered">
                                                        <thead class="thead-light">
                                                        <tr>
                                                            <th>报修人姓名</th>
                                                            <th>报修人学号/工号</th>
                                                            <th>报修人身份</th>
                                                            <th>宿舍楼栋号</th>
                                                            <th>地址房间号</th>
                                                            <th>报修描述</th>
                                                            <th>报修人电话号码</th>
                                                            <th>报修人邮箱</th>
                                                            <th>报修时间</th>
                                                            <th>备注</th>
                                                        </tr>
                                                        </thead>
                                                        <%
                                                            SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
                                                            for(int i=0;i<repairhistory.size();i++){
                                                        %>
                                                        <tbody>
                                                        <tr>
                                                            <td><%=repairhistory.get(i).get("reporterName")%></td>
                                                            <td><%=repairhistory.get(i).get("reporterId")%></td>
                                                            <td><%=repairhistory.get(i).get("reporterType")%></td>
                                                            <td><%=repairhistory.get(i).get("dormBuilding")%></td>
                                                            <td><%=repairhistory.get(i).get("dormRoom")%></td>
                                                            <td><%=repairhistory.get(i).get("repairDesc")%></td>
                                                            <td><%=repairhistory.get(i).get("telephone")%></td>
                                                            <td><%=repairhistory.get(i).get("mail")%></td>
                                                            <td><%=dateFormat.format(repairhistory.get(i).get("date"))%></td>
                                                            <td><%=repairhistory.get(i).get("remark")%></td>
                                                        </tr>
                                                        </tbody>
                                                        <%
                                                                }}
                                                        %>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- 维修历史结束 -->

                                        <!-- 注销登录开始 -->
                                        <div class="tab-pane fade" id="logout" role="tabpanel">
                                            <div class="myaccount-content">
                                                <h5>您确定要注销登录么？</h5>
                                                <a href="/logout" class="btn btn-sqr">确定</a>
                                            </div>
                                        </div>
                                        <!-- 注销登录结束 -->


                                    </div>
                                </div>
                                <!--功能选择面板结束-->

                                <!--任务开始-->
                                <div class="col-lg-9 col-md-8" style="margin-left: 299px;border-bottom: none;">
                                    <div class="tab-content">
                                        <!--正在进行的任务开始 -->
                                        <div class="tab-pane fade" id="repairing" role="tabpane1">
                                            <div class="myaccount-content">
                                                <h5>正在进行的任务</h5>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <%
                                                        List<Map<String, Object>> maintainertask=(List<Map<String, Object>>)request.getAttribute("maintainertask");
                                                        if(maintainertask.size()==0){
                                                    %>
                                                    <h5>目前还没有数据哟~</h5>
                                                    <%
                                                    }else{
                                                    %>
                                                    <table class="table table-bordered">
                                                        <thead class="thead-light">
                                                        <tr>
                                                            <th>报修人姓名</th>
                                                            <th>报修人学号/工号</th>
                                                            <th>报修人身份</th>
                                                            <th>宿舍楼栋号</th>
                                                            <th>地址房间号</th>
                                                            <th>报修描述</th>
                                                            <th>报修人电话号码</th>
                                                            <th>报修人邮箱</th>
                                                            <th>报修时间</th>
                                                            <th>备注</th>
                                                            <th>操作</th>
                                                        </tr>
                                                        </thead>
                                                        <%
                                                            SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
                                                            for(int i=0;i<maintainertask.size();i++){
                                                        %>
                                                        <tbody>
                                                        <tr>
                                                            <td><%=maintainertask.get(i).get("reporterName")%></td>
                                                            <td><%=maintainertask.get(i).get("reporterId")%></td>
                                                            <td><%=maintainertask.get(i).get("reporterType")%></td>
                                                            <td><%=maintainertask.get(i).get("dormBuilding")%></td>
                                                            <td><%=maintainertask.get(i).get("dormRoom")%></td>
                                                            <td><%=maintainertask.get(i).get("repairDesc")%></td>
                                                            <td><%=maintainertask.get(i).get("telephone")%></td>
                                                            <td><%=maintainertask.get(i).get("mail")%></td>
                                                            <td><%=dateFormat.format(maintainertask.get(i).get("date"))%></td>
                                                            <td><%=maintainertask.get(i).get("remark")%></td>
                                                            <td><input type="button" value="施工" onclick="updateState(<%=maintainertask.get(i).get("reportId")%>,4)"></input></td>
                                                        </tr>
                                                        </tbody>
                                                        <%
                                                                }}
                                                        %>
                                                    </table>


                                                </div>

                                            </div>
                                        </div>
                                        <!--正在进行的任务结束-->

                                        <!--已完成的任务开始 -->
                                        <div class="tab-pane fade" id="repairover" role="tabpane1">
                                            <div class="myaccount-content">
                                                <h5>已完成的任务</h5>
                                                <div class="myaccount-table table-responsive text-center">
                                                    <%
                                                        List<Map<String, Object>> finishtask=(List<Map<String, Object>>)request.getAttribute("finishtask");
                                                        if(finishtask.size()==0){
                                                    %>
                                                    <h5>目前还没有数据哟~</h5>
                                                    <%
                                                    }else{
                                                    %>
                                                    <table class="table table-bordered">
                                                        <thead class="thead-light">
                                                        <tr>
                                                            <th>报修人姓名</th>
                                                            <th>报修人学号/工号</th>
                                                            <th>报修人身份</th>
                                                            <th>宿舍楼栋号</th>
                                                            <th>地址房间号</th>
                                                            <th>报修描述</th>
                                                            <th>报修人电话号码</th>
                                                            <th>报修人邮箱</th>
                                                            <th>报修时间</th>
                                                            <th>备注</th>
                                                            <th>操作</th>
                                                        </tr>
                                                        </thead>
                                                        <%
                                                            SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
                                                            for(int i=0;i<finishtask.size();i++){
                                                        %>
                                                        <tbody>
                                                        <tr>
                                                            <td><%=finishtask.get(i).get("reporterName")%></td>
                                                            <td><%=finishtask.get(i).get("reporterId")%></td>
                                                            <td><%=finishtask.get(i).get("reporterType")%></td>
                                                            <td><%=finishtask.get(i).get("dormBuilding")%></td>
                                                            <td><%=finishtask.get(i).get("dormRoom")%></td>
                                                            <td><%=finishtask.get(i).get("repairDesc")%></td>
                                                            <td><%=finishtask.get(i).get("telephone")%></td>
                                                            <td><%=finishtask.get(i).get("mail")%></td>
                                                            <td><%=dateFormat.format(finishtask.get(i).get("date"))%></td>
                                                            <td><%=finishtask.get(i).get("remark")%></td>
                                                            <td><input type="button" value="完工" onclick="updateState(<%=finishtask.get(i).get("reportId")%>,5)"></input></td>
                                                        </tr>
                                                        </tbody>
                                                        <%
                                                                }}
                                                        %>
                                                    </table>

                                                </div>

                                            </div>
                                        </div>
                                        <!--已完成的任务结束-->

                                    </div>
                                </div>
                                <!--任务结束-->



                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>



<!-- footer area start -->
<footer class="black-bg">
    <div class="footer-middle-area">
        <div class="container">
            <div class="row mtn-30">
                <div class="col-lg-6 col-sm-12">
                    <div class="address-block mt-30">
                        <div class="footer-logo">
                            <a href="/">
                                <img src="/img/2.jpg" alt="Brand Logo">
                            </a>
                        </div>
                        <address class="address-info d-flex align-items-center">
                            <i class="fa fa-map-marker"></i>
                            <p><span>ADDRESS : </span> 梦翔大厦</p>
                        </address>
                    </div>
                </div>
                <div class="col-lg-3 col-sm-6">
                    <address class="address-info email mt-30">
                        <i class="fa fa-envelope"></i>
                        <p><span>EMAIL : </span><a href="#">xxxx@qq.com</a></p>
                    </address>
                </div>
                <div class="col-lg-3 col-sm-6">
                    <address class="address-info email mt-30">
                        <i class="fa fa-phone"></i>
                        <p><span>PHONE : </span><a href="#">158xxxxx9442</a></p>
                    </address>
                </div>
            </div>
        </div>
    </div>
    <div class="footer-bottom-area text-center">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="payment-method-list">

                    </div>

                    <p class="copyright">
                        Copyright © www.xxx.com
                    </p>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- footer area end -->


<%--js更新任务状态--%>
<script>
    function my(id){
        return document.getElementById(id);
    }
    my("btn1").onclick=function(){
        my("repairing").style.display="block";
        my("repairover").style.display="none";
    }
    my("btn2").onclick=function(){
        my("repairover").style.display="block";
        my("repairing").style.display="none";
    }
    my("btn3").onclick=function(){
        my("repairover").style.display="none";
        my("repairing").style.display="none";
    }
    my("btn5").onclick=function(){
        my("repairover").style.display="none";
        my("repairing").style.display="none";
    }
    my("btn6").onclick=function(){
        my("repairover").style.display="none";
        my("repairing").style.display="none";
    }
    my("btn10").onclick=function(){
        my("repairover").style.display="none";
        my("repairing").style.display="none";
    }

    function updateState(reportId,state) {
        $.ajax({
            url:"/UpdateState?reportId="+reportId+"&state="+state,
            contentType:"application/json;charset=UTF-8",
            data:{},
            type:"post",
            success:function (data) {
                alert("成功")
                location.reload();

            },
            error:function () {
                alert("审核出现错误");
            }
        })
    };
</script>



<!-- JS
============================================ -->

<!-- Modernizer JS -->
<script src="js/modernizr-3.6.0min.js"></script>
<!-- jQuery JS -->
<script src="js/jquery-3.3.1min.js"></script>
<!-- Popper JS -->
<script src="js/poppermin.js"></script>
<!-- Bootstrap JS -->
<script src="js/bootstrapmin.js"></script>
<!-- slick Slider JS -->
<script src="js/slickmin.js"></script>
<!-- Countdown JS -->
<script src="js/countdownmin.js"></script>
<!-- Nice Select JS -->
<script src="js/nice-selectmin.js"></script>
<!-- jquery UI JS -->
<script src="js/jqueryuimin.js"></script>
<!-- Image zoom JS -->
<script src="js/image-zoommin.js"></script>
<!-- image loaded js -->
<script src="js/imagesloadedpkgdmin.js"></script>
<!-- masonry  -->
<script src="js/masonrypkgdmin.js"></script>
<!-- mailchimp active js -->
<script src="js/ajaxchimp.js"></script>
<!-- contact form dynamic js -->
<script src="js/ajax-mail.js"></script>
<!-- google map api -->
<script src="http://ditu.google.cn/maps/api/js?key=AIzaSyCfmCVTjRI007pC1Yk2o2d_EhgkjTsFVN8"></script>
<!-- google map active js -->
<script src="js/google-map.js"></script>
<!-- Main JS -->
<script src="js/main.js"></script>

<script src="js/jquery.js"></script>


</body>
</html>
